import 'package:base_flutter/base_flutter.dart';
import 'package:flutter/src/widgets/framework.dart';

import '../../model/nurse/nurse_record_model.dart';
import '../../net/response/nurse_record_detail_response.dart';

class NurseRecordDetailViewModel extends BaseViewModel{
  final String detailId;

  NurseRecordDetailViewModel(BuildContext context,{required this.detailId}) : super(context);

  var model = NurseRecordModel();
  NurseRecordDetailResponse? detail;

  Future<void> getDetail() async {
    showLoadingState();
    try{
      detail = await model.getNurseDetail(detailId);
      showContent();
    }catch(e){
      showErrorState(NetErrorUtils.getNetError(e));
    }
  }

  @override
  void onCreated() {
    super.onCreated();
    getDetail();
  }
}